package com.yanghs.common.entity.hbm;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * @author yanghs
 * @Description:
 * @date 2018/3/14 21:27
 */
public class Roleinfo implements Serializable {
    private static final long serialVersionUID = 1L;
    private String roleid;
    private String rolename;
    private Timestamp createtime;
    private Timestamp updatetime;
    private String description;
    private String usable;
    //不序列化 解决hibernate的懒加载和 fastjson序列化时候的错误
    private transient Collection<RoleAuthority> roleAuthoritiesByRoleid;
    private transient Collection<UserRole> userRolesByRoleid;

    public String getRoleid() {
        return roleid;
    }

    public void setRoleid(String roleid) {
        this.roleid = roleid;
    }

    public String getRolename() {
        return rolename;
    }

    public void setRolename(String rolename) {
        this.rolename = rolename;
    }

    public Timestamp getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    public Timestamp getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Timestamp updatetime) {
        this.updatetime = updatetime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUsable() {
        return usable;
    }

    public void setUsable(String usable) {
        this.usable = usable;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Roleinfo roleinfo = (Roleinfo) o;

        if (roleid != null ? !roleid.equals(roleinfo.roleid) : roleinfo.roleid != null) return false;
        if (rolename != null ? !rolename.equals(roleinfo.rolename) : roleinfo.rolename != null) return false;
        if (createtime != null ? !createtime.equals(roleinfo.createtime) : roleinfo.createtime != null) return false;
        if (updatetime != null ? !updatetime.equals(roleinfo.updatetime) : roleinfo.updatetime != null) return false;
        if (description != null ? !description.equals(roleinfo.description) : roleinfo.description != null)
            return false;
        if (usable != null ? !usable.equals(roleinfo.usable) : roleinfo.usable != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = roleid != null ? roleid.hashCode() : 0;
        result = 31 * result + (rolename != null ? rolename.hashCode() : 0);
        result = 31 * result + (createtime != null ? createtime.hashCode() : 0);
        result = 31 * result + (updatetime != null ? updatetime.hashCode() : 0);
        result = 31 * result + (description != null ? description.hashCode() : 0);
        result = 31 * result + (usable != null ? usable.hashCode() : 0);
        return result;
    }

    public Collection<RoleAuthority> getRoleAuthoritiesByRoleid() {
        return roleAuthoritiesByRoleid;
    }

    public void setRoleAuthoritiesByRoleid(Collection<RoleAuthority> roleAuthoritiesByRoleid) {
        this.roleAuthoritiesByRoleid = roleAuthoritiesByRoleid;
    }

    public Collection<UserRole> getUserRolesByRoleid() {
        return userRolesByRoleid;
    }

    public void setUserRolesByRoleid(Collection<UserRole> userRolesByRoleid) {
        this.userRolesByRoleid = userRolesByRoleid;
    }
}
